import request from '@/utils/request'

const userApi = {
  Login: '/login/login',
  Logout: '/login/logout',
  UserInfo: '/managerInfo/info',
  UserEdit: '/managerInfo/edit',
  UserMenu: '/user/nav',
  wxBindBankCode: '/notControl/wxBindBankCode',
  code: '/notControl/code',
  UserPurview: '/index/purview',
  verify: '/login/verify'
}

export function getVerify (parameter) {
  return request({
    url: userApi.verify,
    method: 'get',
    params: parameter
  })
}

export function login (parameter) {
  return request({
    url: userApi.Login,
    method: 'post',
    data: parameter
  })
}

export function getSmsCaptcha (parameter) {
  return request({
    url: userApi.SendSms,
    method: 'post',
    data: parameter
  })
}

export function getInfo () {
  return request({
    url: userApi.UserInfo,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function userEdit (parameter) {
  return request({
    url: userApi.UserEdit,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: parameter
  })
}

export function getCurrentUserNav () {
  return request({
    url: userApi.UserMenu,
    method: 'get'
  })
}

export function logout () {
  return request({
    url: userApi.Logout,
    method: 'get'
  })
}

export function getWxBindBankCode () {
  return request({
    url: userApi.wxBindBankCode,
    method: 'get'
  })
}

export function getCode (params) {
  return request({
    url: userApi.code,
    method: 'get',
    params
  })
}

export function getUserPurview (params) {
  return request({
    url: userApi.UserPurview,
    method: 'get',
    params
  })
}
